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