UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ETIwi3Nz7gp3l6/skheA0wUWS2xVtevhTaAe5cSRjPQ=' 
WHERE 
  key_id = '46a830f34d5f26ad820d74123842399543eac64bf9c51b00f4df35e9d27c7ca7' 
  AND (
    token = 'ETIwi3Nz7gp3l6/skheA0wUWS2xVtevhTaAe5cSRjPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021