UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rtX06jSLUckTAEFlwwHqPdllOri9Ob0tleraSI6OypA=' 
WHERE 
  key_id = '68e63d8ddf53aa3f00f2b87b2b86c483e7afbe3039764c2a24aa27ed4a62c507' 
  AND (
    token = 'rtX06jSLUckTAEFlwwHqPdllOri9Ob0tleraSI6OypA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00096