UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tKCYIvBuC+1QP2kQ+66LlsAP3bwOu0Uorj636q6qrRc='
WHERE
key_id = '7b9bb66df37c932f849af8e9c3c81e30156a5db5327a0f8fb026b028307905dc'
AND (
token = 'tKCYIvBuC+1QP2kQ+66LlsAP3bwOu0Uorj636q6qrRc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)