UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CFYhOLXxlh8lPKvb4fpj31QlIpzSY0foLBHiCrZ3i0E=' 
WHERE 
  key_id = 'e660c3e4c5587162fb00f8aac3e56ac5ecac361308bb2fbb434fdfcbf4b90245' 
  AND (
    token = 'CFYhOLXxlh8lPKvb4fpj31QlIpzSY0foLBHiCrZ3i0E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026