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