UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0kelBaiY/ZQtDdqtr38Oe20H2jTFaHq9hLwEu9qOQE4='
WHERE
key_id = 'bdbcfacd33154123a880b852ad4823abb371d786f0641ae3648920bf138ed8f2'
AND (
token = '0kelBaiY/ZQtDdqtr38Oe20H2jTFaHq9hLwEu9qOQE4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)