UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4k4ma0bRq7X/c6siKADcaxbYVMq5Ok0QELVQ2hXuRY4='
WHERE
key_id = '24493b8cf2b2a6d4f3093799065d8a7c6ffc0712c8a5ac3e6e55907168825096'
AND (
token = '4k4ma0bRq7X/c6siKADcaxbYVMq5Ok0QELVQ2hXuRY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)