UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KEyKn1omU5BPyF5QkEtwE56Y3L57TR1+n7nJbxLdue8='
WHERE
key_id = 'bda87809ba90c3e88fd0d896744f53f4607c28e6814616fa7fb4e017cc511ba7'
AND (
token = 'KEyKn1omU5BPyF5QkEtwE56Y3L57TR1+n7nJbxLdue8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)