UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lnb3Z9qEU7GQETd60Kf54pA3M3TByXI+5GqzSBO/7+E=' 
WHERE 
  key_id = '6d9ff391acbe41e317f043cc71059207f127138633a34c16741cc57b463f8bb1' 
  AND (
    token = 'lnb3Z9qEU7GQETd60Kf54pA3M3TByXI+5GqzSBO/7+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030