UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YCuI/teR02rM/u8+MFnwy7SpPC8uLBl45Semsc16gq4=' 
WHERE 
  key_id = '9466546d7af12e08b2d313ff0de3a45b42fa206e30cb8ae1ad7b572dd63cc51d' 
  AND (
    token = 'YCuI/teR02rM/u8+MFnwy7SpPC8uLBl45Semsc16gq4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030