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