UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gQgxQuoRlq+k4a4haYmk6L/TXSm0N0r9SKQgj1gs8iY='
WHERE
key_id = 'a8b37a30fac1666ebc67bbbb9b32f38234233dc98c78f07c2d1b367caea7fac3'
AND (
token = 'gQgxQuoRlq+k4a4haYmk6L/TXSm0N0r9SKQgj1gs8iY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)