UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BmrrNcv4DzX2V9XQtnvegJ/UEofJXfLTPcqXzAFlBcw='
WHERE
key_id = 'c32b13625e557cfc38dc90affd482b18aaa9c27fae4697d8fdda830df53c247d'
AND (
token = 'BmrrNcv4DzX2V9XQtnvegJ/UEofJXfLTPcqXzAFlBcw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)