UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G5vEit1yic0auyMbSWTgbjF2BKbyoONjdYcWu+rimsE=' 
WHERE 
  key_id = 'fa80605cf6ecf44946e10256e108946eef658f51bf274a102efc51304d02a267' 
  AND (
    token = 'G5vEit1yic0auyMbSWTgbjF2BKbyoONjdYcWu+rimsE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030