UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xr8YkEJU2rg7yAozZA/mFkAFku72plOYoFAza0327sg='
WHERE
key_id = 'a4e4ecefbbb694e6a8d08d3e89db7dffbf383a398072ee0dd7256be9f05d1f0b'
AND (
token = 'xr8YkEJU2rg7yAozZA/mFkAFku72plOYoFAza0327sg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)