UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lyAWPBWV0sCSy1tyXgXXJw51vhTO27jkBnjzpMvbtWo=' 
WHERE 
  key_id = '779751216d238b1c416ff7e9dda6d5cf0f89f59243d1b9efbf8d8a8c6445952f' 
  AND (
    token = 'lyAWPBWV0sCSy1tyXgXXJw51vhTO27jkBnjzpMvbtWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016