UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ssn6rE7iN8BF4npgGZibKeR/HmpLWWXYcEccjzx3Nu0='
WHERE
key_id = 'c46c986abf6e07a0532c5f544a6d4b336728aedaac236d0cb7144d47171c43bb'
AND (
token = 'Ssn6rE7iN8BF4npgGZibKeR/HmpLWWXYcEccjzx3Nu0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)