UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GdlwbRwqR/R+FdpKeWg/oM3CuwAAqirG6woICS8ZISU='
WHERE
key_id = 'af56286222cf94cabc2d2a6589d6f2d0690905accc57bb85777dac4aa32c5584'
AND (
token = 'GdlwbRwqR/R+FdpKeWg/oM3CuwAAqirG6woICS8ZISU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)