UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dd2AkHc0s/LE8chx8PAXGW+4a6sWSSRblBFecp3W2kg='
WHERE
key_id = '529a252c816fb73af9daa52a05a66582bbb69d3ca94c2441e330ba0ba6dd8215'
AND (
token = 'dd2AkHc0s/LE8chx8PAXGW+4a6sWSSRblBFecp3W2kg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)