UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/UdiDyVdU/17/+JnUjkM1+0h8LtP6cPVFRL0s/tsDQY=' 
WHERE 
  key_id = 'c4ca31643ff89821028c7d76bfa72e4bb0807175a7ae546c3916b506272993d9' 
  AND (
    token = '/UdiDyVdU/17/+JnUjkM1+0h8LtP6cPVFRL0s/tsDQY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055