UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bND6qAgFbbStcvhoGsN5hdQDiMvdY1EcrNyg8L4T9J8='
WHERE
key_id = '2ed624bf8176d074ac5bc165dfbd3aa6ef458bf200188f1a332a285e797b71b6'
AND (
token = 'bND6qAgFbbStcvhoGsN5hdQDiMvdY1EcrNyg8L4T9J8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)