UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ojYgt79gHVoTzIsVYIMBs8JN9IZs3q787/1s7VxsRvY=' 
WHERE 
  key_id = 'f57eb23e584235bef829d05958276d7863fe01440623e79d05621e45de8f0c4b' 
  AND (
    token = 'ojYgt79gHVoTzIsVYIMBs8JN9IZs3q787/1s7VxsRvY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024