UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CcWWSUZ3LlDhk+vusN8Zn0zgJW8Y5ECeGqUDrvYgyi4='
WHERE
key_id = '13a25f6256e198d822a52288e367d5383e9d522d7ae34f4313b7e1a91aac4591'
AND (
token = 'CcWWSUZ3LlDhk+vusN8Zn0zgJW8Y5ECeGqUDrvYgyi4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)