UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7gaAQjYWP1kxQL8cXXKO67Bwq9auP2E3eAOLqYMdRH8='
WHERE
key_id = '2f8b51cbeea72ac2f3802dec0d9f77cbec955cc004b648c71d74d441e684ff1e'
AND (
token = '7gaAQjYWP1kxQL8cXXKO67Bwq9auP2E3eAOLqYMdRH8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)