UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cdoYW9Y+ykQBnr+SrNz8cRG4vpAerNaZLxvwfhh3458=' 
WHERE 
  key_id = '433ac82af712a83b0534323a65388362c3b5d8cdbc0cd3605bbad51d7a873f99' 
  AND (
    token = 'cdoYW9Y+ykQBnr+SrNz8cRG4vpAerNaZLxvwfhh3458=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016