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