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