UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VvpeTZf8nhti/bt6gjosrnpofX2qGvGDeBOWXh4VHA0='
WHERE
key_id = 'a51b648230721a21cef72b72e3c6fe8b9ad559c221790956a02abea9f41ed08b'
AND (
token = 'VvpeTZf8nhti/bt6gjosrnpofX2qGvGDeBOWXh4VHA0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)