UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sLsZ/jRxwX+U8F6ylP6LeM25FSrE2LNeuvvMGEp8Y3c='
WHERE
key_id = 'c5a7bbaafa52d09d8f3525972fc2eaea834c451da328528f82a177a3753fd809'
AND (
token = 'sLsZ/jRxwX+U8F6ylP6LeM25FSrE2LNeuvvMGEp8Y3c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)