UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oW3lRY4rGqAvJrahPdPcZDnijAotq5jhD5iqFM3Z1CY='
WHERE
key_id = 'ae683a2e9a69c7284f6bbd36e9f3bfaba5cfde0437b9e96cfe7fce6a89a0b7b1'
AND (
token = 'oW3lRY4rGqAvJrahPdPcZDnijAotq5jhD5iqFM3Z1CY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)