UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J+i/E3jif5E+ascjrfnUh1pEvx5IqM5TJiBkMaSm6KU='
WHERE
key_id = '917333864ca0f770f1895643a1afda01cfa432794628ddc3b2016d8d65610053'
AND (
token = 'J+i/E3jif5E+ascjrfnUh1pEvx5IqM5TJiBkMaSm6KU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)