UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c5WeQDT/85Rgz1DCVlb9hYPcVUJCAbJ3PLy8f7DeQk4='
WHERE
key_id = 'a8150c25d37bb7df423b15150aeb6f780968727e658f7ecbdb44c317f03e0ed4'
AND (
token = 'c5WeQDT/85Rgz1DCVlb9hYPcVUJCAbJ3PLy8f7DeQk4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)