UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eJefTjdb0iLDNRF9gxqHCl8wNwxtRbeVIWMqHZ3xjB0='
WHERE
key_id = '477a72be12f3175b9d3317620cca950e10c84f807be2639c0020057abe86798e'
AND (
token = 'eJefTjdb0iLDNRF9gxqHCl8wNwxtRbeVIWMqHZ3xjB0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)