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