UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VvYQfAkTERw61zTE/U6Q9bE8hq235drw2jV6MV/P9JY=' 
WHERE 
  key_id = '813cf1b4370b3b86e908202013b2db36d525acfeedded9649012a983451fb57f' 
  AND (
    token = 'VvYQfAkTERw61zTE/U6Q9bE8hq235drw2jV6MV/P9JY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030