UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gy/hchdIKSogZunBvBpGbM58bnnusHqdIu7d5qeM8D0=' 
WHERE 
  key_id = 'd03ce1d4c44842400e94eae4dbdbd012dcd36602181c1ebd684483812fb273d0' 
  AND (
    token = 'gy/hchdIKSogZunBvBpGbM58bnnusHqdIu7d5qeM8D0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037