UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2F1uZmrE19Q4vmayCc7aBVTqKw1h2ZPc4knWQj4sPwk='
WHERE
key_id = '52fab6e125b9efc8477df5f0e4b78f6ace8291fe895c796f0a3d6d80df024d17'
AND (
token = '2F1uZmrE19Q4vmayCc7aBVTqKw1h2ZPc4knWQj4sPwk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)