UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1A3+9+yDmxz6pCTQq7RDGEPOa4JGjmE6D7cJJcg9vjg='
WHERE
key_id = '1238d5790c12b5e6b38fa3178943d7c5dcfc2e5394d8f67ea7af86b46e5a51fc'
AND (
token = '1A3+9+yDmxz6pCTQq7RDGEPOa4JGjmE6D7cJJcg9vjg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)