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